﻿///////////////////////////////////////////////////////////////////////////////
//
// This file is part of the BassDrop project
//   https://code.google.com/p/bass-drop/
//
//
// Creator:	Gergely Krajcsovszki (krajcsovszkig@hotmail.com)
// Date:	2014-01-21 14:10
//
//
// Copyright © 2013-2014. Gergely Krajcsovszki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BassDrop.Core.Common.Services
{
	/// <summary>
	/// Common interface for application settings
	/// </summary>
	public interface ISettings
	{
		/// <summary>
		/// Returns a setting value for the specified plugin / plugin instance
		/// </summary>
		/// <param name="settingName">the name of the setting you want</param>
		/// <param name="pluginName">the name of the plugin</param>
		/// <param name="instanceName">the name of the plugin instance or null if you want a static setting</param>
		/// <returns></returns>
		string PluginSettingAt( string settingName, string pluginName, string instanceName = null );

		/// <summary>
		/// Sets a setting value for the specified plugin / plugin instance
		/// </summary>
		/// <param name="settingName">the name of the setting you want to set</param>
		/// <param name="settingValue">the value of the setting</param>
		/// <param name="pluginName">the name of the plugin</param>
		/// <param name="instanceName">the name of the plugin instance or null if you want a static setting</param>
		/// <returns></returns>
		void SetPluginSettingAt( string settingName, string settingValue, string pluginName, string instanceName = null );

		/// <summary>
		/// Deletes the settings of the specified plugin / plugin instance
		/// </summary>
		/// <param name="pluginName">the name of the plugin</param>
		/// <param name="instanceName">the name of the plugin instance or null if you want a static setting</param>
		void ClearPluginSettings( string pluginName, string instanceName = null );

		/// <summary>
		/// Returns all settings of the specified plugin in a dictionary
		/// </summary>
		/// <param name="pluginName">the name of the plugin</param>
		/// <param name="instanceName">the name of the plugin instance or null if you want the static settings</param>
		/// <returns></returns>
		IDictionary<string, string> PluginSettings( string pluginName, string instanceName = null );

		/// <summary>
		/// Returns the list of saved plugin instance names
		/// </summary>
		/// <param name="pluginName">the name of the plugin</param>
		/// <returns></returns>
		IEnumerable<string> PluginInstances( string pluginName );

		/// <summary>
		/// Returns the setting at the specified path
		/// </summary>
		/// <param name="path">A path as "settingGroup1/settingGroup2/setting"</param>
		/// <returns>The setting at the specified path or null if it doesn't exist</returns>
		string SettingAt( string path );

		/// <summary>
		/// Sets a setting at the specified path with the specified value. Creates the path (groups)
		/// to it if necessary.
		/// </summary>
		/// <param name="path">A path as "settingGroup1/settingGroup2/setting"</param>
		/// <param name="value">Value of the setting</param>
		/// <returns>The value parameter</returns>
		void SetSettingAt( string path, string value );

		/// <summary>
		/// Deletes the settings on the passed path
		/// </summary>
		/// <param name="path">A path as "settingGroup1/settingGroup2/setting"</param>
		void ClearSettings( string path );

		/// <summary>
		/// Saves the settings to file
		/// </summary>
		void Save();
	}
}
